package com.example.makerspace.controller.project;

import com.example.makerspace.dto.Result;
import com.example.makerspace.dto.maker.AreaBaseDTO;
import com.example.makerspace.dto.project.LanguageBaseDTO;
import com.example.makerspace.service.AreaService;
import com.example.makerspace.service.LanguageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@ResponseBody
@RequestMapping("/api/language")
public class LanguageController {

    @Autowired
    private LanguageService languageService;

    @PostMapping("/create")
    public Result create(@RequestBody LanguageBaseDTO languageBaseDTO) {
        return languageService.create(languageBaseDTO);
    }

    @GetMapping("/query")
    public Result query(){
        return languageService.query();
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody LanguageBaseDTO languageBaseDTO){
        return languageService.delete(languageBaseDTO.getId());
    }

    @PostMapping("/update")
    public Result update(@RequestBody LanguageBaseDTO languageBaseDTO){
        return languageService.update(languageBaseDTO);
    }
}
